/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package WebServices;

import Interfaces.Factory;
import Interfaces.ICtrlJuegoDatos;
import java.util.logging.Logger;
import javax.jws.WebMethod;
import javax.jws.WebService;
import javax.jws.soap.SOAPBinding;
import javax.jws.soap.SOAPBinding.ParameterStyle;
import javax.jws.soap.SOAPBinding.Style;
import javax.xml.ws.Endpoint;

/**
 *
 * @author Sebas
 */
@WebService
@SOAPBinding(style = Style.RPC, parameterStyle = ParameterStyle.WRAPPED)

public class CtrlJuegoDatosWS implements ICtrlJuegoDatos{

    private Endpoint endpoint = null;
    private Logger log = Logger.getLogger(CtrlJuegoDatosWS.class.getName());

    @WebMethod(exclude = true)
    public void publicar() {
        Propiedades propiedades = Propiedades.getInstance();
        String nomCtrl = "CtrlJuegoDatos";
        String camino = "http://" + propiedades.getServer() + ":" + propiedades.getPuerto() + "/" + nomCtrl;
        log.info("publicando el endpoint "+nomCtrl);
        endpoint = Endpoint.publish(camino, this);
        log.info("Endpoint "+nomCtrl+" publicado en " + camino);
    }

    @WebMethod(exclude = true)
    public Endpoint getEndpoint() {
        return endpoint;
    }
    
    @Override
    @WebMethod
    public void agregarJuego() {
        ICtrlJuegoDatos ctrlJuego = Factory.getInstance().getJuegoDatos();
        ctrlJuego.agregarJuego();
    }
    
}
